package org.soretro.portfolio.model
{
	import flash.utils.Timer;
	
	import org.robotlegs.mvcs.Actor;
	import org.soretro.portfolio.helpers.swfAddress.SWFAddress;
	
	public class MainNavigationModel extends Actor
	{
		private var loading:Boolean = false;
		public var pages:Array = [];
		private var currentPage:uint = 0;
		private var timer:Timer;
		
		public function MainNavigationModel()
		{
			super();
			changePage();
		}
		
		public function getCurrentPage():uint
		{
			changePage();
			return currentPage;
		}
		
		public function getPageName( id:int ):String {
			var str:String = "";
			switch( id )
			{
				case 0:
				{
					str = "home";
					break;
				}
				case 1:
				{
					str = "flash_work";
					break;
				}
				case 2:
				{
					str = "game_work";
					break;
				}
				case 3:
				{
					str = "web_work";
					break;
				}
				case 4:
				{
					str = "sandbox";
					break;
				}
				case 5:
				{
					str = "fun_stuff";
					break;
				}
			}
			
			return str;
		}
		
		public function changePage( bttnId:uint = 0, url:String = "" ):void
		{
//			currentPage = bttnId;
			
			switch( SWFAddress.getPath() )
			{
				case "/home":
				{
					currentPage = 0;
					break;
				}
				case "/flash_work":
				{
					currentPage = 1;
					break;
				}
				case "/game_work":
				{
					currentPage = 2;
					break;
				}
				case "/web_work":
				{
					currentPage = 3;
					break;
				}
				case "/sandbox":
				{
					currentPage = 4;
					break;
				}
				case "/fun_stuff":
				{
					currentPage = 5;
					break;
				}
			}
		}
		
		// Private methods //
		
		public function startLoading():void
		{
			loading = true;
		}
		
		public function endLoading():void
		{
			loading = false;
		}
	}
	
	
}